package com.bj58.analysis.tools;

import org.apache.commons.lang.StringUtils;

import com.bj58.analysis.tools.common.GetObjectToClassUtils;
import com.bj58.analysis.tools.common.TrackUrlUtils;
import com.bj58.analysis.tools.common.bean.LogBean;
import com.bj58.analysis.tools.etl.bean.ETLTrackBean;

/**
 * @description 对track ETL后的日志进行解析封装
 * @author tzc
 *
 */
public class ETLTrackAnalysis extends CommonAnalysis {

	@Override
	protected LogBean analysis(String logLine) {
		ETLTrackBean bean=null;
		if(StringUtils.isNotBlank(logLine)){
			String[] lines=logLine.split("\\|", -1);
			bean=(ETLTrackBean)GetObjectToClassUtils.getObjectByArray(ETLTrackBean.class, lines);
			
			//兼容旧版trackurl
//			String trackUrl=bean.getTrackUrl();
//			if(StringUtils.isNotBlank(trackUrl)){
//				String tmpTrackUrl=TrackUrlUtils.formatTrackUrl(trackUrl);
//				bean.setTrackUrl(tmpTrackUrl);
//			}
		}
		return bean;
	}

}
